<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
    </head>
    <body>
        
    </body>
    <script>
        // ES6 引入rest参数,用于获取函数的实参,用来代替  arguments

        // es5 获取实参的方式
        function date(){
            console.log(arguments);// 此时是一个对象
        }
        date("哈哈","呵呵","嘿嘿");


        // rest参数
        
        function data(...args){
            console.log(args);// 此时是数组
        }
        data("哈哈","呵呵","嘿嘿");
        // rest 参数必须要放到参数最后
        function fn(a,b,...args){
            console.log(a);//1
            console.log(b);//2
            console.log(args);//[3, 4, 5, 6, 7]
        }
        fn(1,2,3,4,5,6,7);
    </script>
</html>